package com.moore.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moore.bean.Community;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CommunityMapper extends BaseMapper<Community> {
    @Update("UPDATE community SET comment_count = comment_count + 1 WHERE community_id = #{id}")
    void addCommentCount(Long id);

    @Update("UPDATE community SET comment_count = comment_count - 1 WHERE community_id = #{id}")
    void reduceCommentCount(Long id);

    @Update("UPDATE community SET like_count = like_count + 1 WHERE community_id = #{id}")
    void addLikeCount(Long id);

    @Update("UPDATE community SET like_count = like_count - 1 WHERE community_id = #{id}")
    void reduceLikeCount(Long id);

    @Update("UPDATE community SET star_count = star_count + 1 WHERE community_id = #{id}")
    void addStarCount(Long id);

    @Update("UPDATE community SET star_count = star_count - 1 WHERE community_id = #{id}")
    void reduceStarCount(Long id);

    @Update("UPDATE community SET report_status = report_status + 1 WHERE community_id = #{id}")
    int addReportCount(Long id);
}